﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>用户登录</title>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/m.jui.css" />
    <script src="js/m.jui.js"></script>
</head>
<body ms-controller="indexview" class="ms-controller">
    <div class="jui-scrollview">
        <header class="jui-bar jui-barwhite" style="background: #5A738E;">
            <h1 class="title" style="color:#FFFFFF;">用户登录</h1>
        </header>
        <div class="jui-list-block" style="margin: 0;margin-top:100px;">
            <div class="jui-list-content" >
                <div class="jui-list-center">
                    <div class="center-title">账号</div>
                    <div class="center-input">
                        <input type="text" placeholder="请输入账号" ms-duplex="@UserName" />
                    </div>

                </div>
            </div>
            <div class="jui-list-content">
                <div class="jui-list-center">
                    <div class="center-title">密码</div>
                    <div class="center-input">
                        <input type="password" placeholder="请输入密码" ms-duplex="@Password" />
                    </div>

                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-100" style="margin-left:0;width:100%;"><a href="javascript:void(0)" class="jui-button button-gren" ms-click="@Login()" >登录</a></div>
        </div>
       </div>

    <script src="js/layer/mobile/layer.js"></script>
    <script src="js/zepto.min.js"></script>
    <script src="js/avalon.mobile.min.js"></script>
    <script src="../admin/Scripts/ComFunJS.js"></script>
    <script>
        var model = avalon.define({
            $id: "indexview",
            UserName: "",
            Password:"",
            Login: function () {
                if (model.UserName && model.Password) {
                    $.post("/API/API.ashx?action=BASE_LOGIN", { P1: model.UserName, P2: model.Password }, function (result) {
                        var r = JSON.parse(result);
                        if (r.error == "") {
                            ComFunJS.saveToken(r.result);
                            window.location.replace("/admin/indexpage.html");
                        } else {
                            alert(r.error);
                        }

                    })
                } else {

                    ComFunJS.showMsg("请输入账号和密码");
                }
            }
        })

        avalon.ready(function () {


        })
    </script>
</body>
</html>
